<template>
  <div class="search-list">
    <Header :queryKey="queryKey"></Header>
    <List :list="list"></List>
  </div>
</template>
<script>
import Header from '@/components/search/Header.vue'
import List from '@/components/home/List.vue';
import {getSearchList} from '@/api/search.js'
export default {
  name:'SearchList',
  components:{List,Header},
  created(){
    this.queryKey = this.$route.query.key || '';//获取上个页面的传值
    this.getData()
  },
  data(){
    return{
      list:[],//数据
      queryKey:''//搜索值
    }
  },
  methods:{
    // 获取数据
    async getData(){
      let res = await getSearchList();
      this.list = res.data.result;
    }
  }
}
</script>